using MediatR;
using B.S.XZYData.ErrorCode;

namespace B.S.XZYData.Api.Read.Application.Command.ProductionStatistics
{
    /// <summary>
    /// 查询产量统计命令
    /// </summary>
    public class QueryProductionStatisticsCommand : IRequest<ApiResult<ProductionStatisticsPageResult>>
    {
        /// <summary>
        /// 页码
        /// </summary>
        public int PageIndex { get; set; } = 1;

        /// <summary>
        /// 每页大小
        /// </summary>
        public int PageSize { get; set; } = 30;

        /// <summary>
        /// 报工日期开始
        /// </summary>
        public DateTime? ReportingDateStart { get; set; }

        /// <summary>
        /// 报工日期结束
        /// </summary>
        public DateTime? ReportingDateEnd { get; set; }

        /// <summary>
        /// 工单计划数最小值
        /// </summary>
        public int? WorkOrderPlanCountMin { get; set; }

        /// <summary>
        /// 工单计划数最大值
        /// </summary>
        public int? WorkOrderPlanCountMax { get; set; }

        /// <summary>
        /// 产品名称
        /// </summary>
        public string? ProductName { get; set; }

        /// <summary>
        /// 产品编号
        /// </summary>
        public string? ProductNumber { get; set; }

        /// <summary>
        /// 产品规格
        /// </summary>
        public string? ProductSpecification { get; set; }

        /// <summary>
        /// 单位
        /// </summary>
        public string? Unit { get; set; }

        /// <summary>
        /// 数量最小值
        /// </summary>
        public int? QuantityMin { get; set; }

        /// <summary>
        /// 数量最大值
        /// </summary>
        public int? QuantityMax { get; set; }

        /// <summary>
        /// 排序字段
        /// </summary>
        public string SortField { get; set; } = "Id";

        /// <summary>
        /// 排序方向
        /// </summary>
        public string SortDirection { get; set; } = "desc";
    }

    /// <summary>
    /// 产量统计分页结果
    /// </summary>
    public class ProductionStatisticsPageResult
    {
        /// <summary>
        /// 产量统计列表
        /// </summary>
        public List<ProductionStatisticsDto> Data { get; set; } = new List<ProductionStatisticsDto>();

        /// <summary>
        /// 总数
        /// </summary>
        public int Total { get; set; }

        /// <summary>
        /// 页码
        /// </summary>
        public int PageIndex { get; set; }

        /// <summary>
        /// 每页大小
        /// </summary>
        public int PageSize { get; set; }
    }

    /// <summary>
    /// 产量统计DTO
    /// </summary>
    public class ProductionStatisticsDto
    {
        /// <summary>
        /// 产量统计ID
        /// </summary>
        public long Id { get; set; }

        /// <summary>
        /// 报工日期
        /// </summary>
        public DateTime ReportingDate { get; set; }

        /// <summary>
        /// 工单计划数
        /// </summary>
        public int? WorkOrderPlanCount { get; set; }

        /// <summary>
        /// 产品名称
        /// </summary>
        public string ProductName { get; set; } = string.Empty;

        /// <summary>
        /// 产品编号
        /// </summary>
        public string ProductNumber { get; set; } = string.Empty;

        /// <summary>
        /// 产品规格
        /// </summary>
        public string? ProductSpecification { get; set; }

        /// <summary>
        /// 单位
        /// </summary>
        public string? Unit { get; set; }

        /// <summary>
        /// 数量
        /// </summary>
        public int Quantity { get; set; }

        /// <summary>
        /// 创建时间
        /// </summary>
        public DateTime? CreatorDate { get; set; }

        /// <summary>
        /// 创建人
        /// </summary>
        public string? Creator { get; set; }
    }
} 